# -*- coding:utf-8 -*-

from xml.etree.ElementTree import ElementTree,Element
import xml.etree.ElementTree as ET
from PIL import Image
import os
import json

set = {0,}
def csvtoxml(filepath):
    tree = ET.parse(filepath)
    root = tree.getroot()
    for elem in root.iter('name'):
        # print(elem.text)
        set.add(elem.text)
    # tree.write(filepath)
    # list = root.getElementsByTagName("name")
    # # print(list[0].childNodes[0].data)
    # for item in list:
    #     if item.childNodes[0].data=="塑料泡沫":
    #         item.childNodes[0].data = "泡沫塑料"
    #         print("出现了第："+str(num))
    # dom.write(filepath)



if __name__ == "__main__":
    dir = "D:/test/result-1/"

    for path in os.listdir(dir):
        filepath = os.path.join(dir, path)
        csvtoxml(filepath)
    print(set)

# 保存文件
